Skip to content

Use reinterpret_cast to cast __FlashStringHelper to const char* #1770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 5, 2014
Merged

Conversation

Lauszus
Copy link
Contributor

@Lauszus Lauszus commented Dec 27, 2013

The cast from __FlashStringHelper to const char* produced the following warning:

/Users/Lauszus/GitHub/Arduino/build/macosx/work/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/Print.cpp: In member function 'size_t Print::print(const __FlashStringHelper*)':
/Users/Lauszus/GitHub/Arduino/build/macosx/work/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/Print.cpp:44: warning: '__progmem__' attribute ignored

As the F() macro is defined this way:

#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
. We should use reinterpret_cast to cast it back to a const char*.

@cmaglie cmaglie merged commit 5d361f5 into arduino:ide-1.5.x Jan 5, 2014
@Lauszus Lauszus deleted the cast branch January 5, 2014 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants